package com.yanmaohu.yulia.statement;

import com.yanmaohu.yulia.bean.DynamicCursorName;
import com.yanmaohu.yulia.bean.InputUsingClause;

/**
 * @author Bright Lee
 */
public final class DynamicOpenStatement implements SqlDynamicDataStatement, Statement {

    private int beginIndex;
    private int endIndex;
    private DynamicCursorName dynamicCursorName;
    private InputUsingClause inputUsingClause;

    public DynamicOpenStatement(int beginIndex,
                                DynamicCursorName dynamicCursorName,
                                InputUsingClause inputUsingClause) {
        this.beginIndex = beginIndex;
        this.endIndex = inputUsingClause != null ? inputUsingClause.getEndIndex() : dynamicCursorName.getEndIndex();
        this.dynamicCursorName = dynamicCursorName;
        this.inputUsingClause = inputUsingClause;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public DynamicCursorName getDynamicCursorName() {
        return dynamicCursorName;
    }

    public InputUsingClause getInputUsingClause() {
        return inputUsingClause;
    }

}
